package com.project.service.impl.front.preSchool;

import java.sql.Connection;
import java.util.List;

import org.apache.commons.logging.Log;

import com.project.dao.IDaoTag;
import com.project.dao.TagDaoImpl;
import com.project.service.common.CommonServiceImpl;
import com.project.service.front.preSchool.INewsTitleTagService;
import com.project.webapp.form.BaseForm;
import com.project.webapp.form.front.preSchool.ArticleForm;

public class NewsTitleTagServiceImpl extends CommonServiceImpl implements
		INewsTitleTagService {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private IDaoTag daoTag = null;

	public List<BaseForm> getNewsTitle() throws Exception {
		
		return null;
	}

	
	
	@Override
	//主页新闻上的获取
	public List<BaseForm> queryImp(BaseForm form, Connection con, Log log)
			throws Exception {
		ArticleForm artForm = (ArticleForm) form;
		
		if ("course".equals(artForm.getType())) {
			// 课程
			return processCourse(artForm, con, log);
		}
		//课程主页上的新闻显示
		if("courses".equals(artForm.getType())){
			//System.out.println("我进入了课程主页上的新闻显示");
			return processCourses(artForm, con, log);
		}
		return null;
	}
	//获取主页上的新闻标题
	private List<BaseForm> processCourse(ArticleForm artForm, Connection con,
			Log log) throws Exception {
		IDaoTag tagDao = new TagDaoImpl();
		return tagDao.getNewsTitle(artForm, con, log);
	}
	//获取课程主页上的课程标题
	private List<BaseForm> processCourses(ArticleForm artForm, Connection con,
			Log log) throws Exception {
			IDaoTag tagDao = new TagDaoImpl();
		return tagDao.getNewsCourseTitle(artForm, con, log);
	}

	public IDaoTag getDaoTag() {
		return daoTag;
	}

	public void setDaoTag(IDaoTag daoTag) {
		this.daoTag = daoTag;
	}




}
